﻿#pragma once
#include <string>
#include "mongoose.h"

using namespace std;

class HttpClient
{
public:
	HttpClient() {}
	~HttpClient() {}

public:
    void add_post_key_value(string& fmtdata, const string& key, const string& val, const string& boundary);
    void add_post_file(string& fmtdata, const string& key, const string& val, const string& boundary);
    string get_protocal_head(const string& content_type, unsigned long long content_len, const string& boundary);
    string get_post_end_data(const string& boundary);

private:
    string ulltoString(long long lldata);

public:
	static void on_http_response(const string res);
    static void send_get_req(const std::string &url);
    static void send_post_req(const string &url, const string &headers, char* postdata);
    static void on_http_event(mg_connection *connection, int event_type, void *event_data);
};
